<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>setup与渲染函数一起使用</title>
</head>

<body>
    <div id="app">
        
    </div>
</body>
<script src="./js/vue.global.js"></script>
<script>

    const { createApp, ref, onMounted,h,reactive } = Vue

  
    const app = createApp({
        setup(){

            let count = ref(5);
            console.log("count.value",count.value);//5

            let sourceObj = { count:count }; // count属性是ref对象
            console.log("sourceObj.count",sourceObj.count); // count属性是ref对象

            let countProxy = reactive(sourceObj);//此时ref会被解包，所以说，countProxy.count就是原始的count.value。
            console.log("countProxy.count",countProxy.count);//5

            console.log(count.value === countProxy.count);//true

            count.value++;
            console.log("count.value++后",count.value);//6
            console.log("countProxy.count",countProxy.count);//6

            countProxy.count ++;
            console.log("countProxy.count ++后",countProxy.count);//7
            console.log("count.value",count.value);//7

          
            return {

            }
        }
    })



    app.mount('#app')
</script>

</html>